#!/usr/bin/python
# -*- coding: utf8 -*-

#######################################################
## 操作sqlite数据库
# 1、类的使用
# 2、用队列实现线程间数据交互
#######################################################

import sqlite3

# 连接数据库
conn = sqlite3.connect('test.db')
print("Opened database successfully")

c = conn.cursor()
c.execute(
    "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \
    VALUES (1, 'Paul', 32, 'California',20000.00)"
)

c.execute(
    "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \
    VALUES (2, 'Allen', 25, 'Texas',15000.00)"
)

c.execute(
    "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \
    VALUES (3, 'Teddy', 23, 'Norway',20000.00)"
)

c.execute(
    "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \
    VALUES (4, 'Mark', 25, 'Rich-Mond',65000.00)"
)

conn.commit()
print("Records created ok")
conn.close()
